<!DOCTYPE html>
<html>
<!-- head -->
{include file="common/page/head"}
<link rel="stylesheet" href="__app__/admin/view/AssembleGoods/editGoods/editGoods.css" />
<body>
<!---------------- 编辑商品 ------------------->
<!-- 页头 -->
{include file="common/page/header"}
<!-- jsfiles -->
{include file="common/page/jsfiles"}
<link href="__static__/js/umeditor/themes/default/css/umeditor.min.css" type="text/css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" src="__static__/js/umeditor/third-party/template.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__static__/js/umeditor/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__static__/js/umeditor/umeditor.min.js"></script>
<script type="text/javascript" src="__static__/js/umeditor/lang/zh-cn/zh-cn.js"></script>
<!-- 主体 -->
<div class="content container-fluid {if $leftBarScale eq '1'} scale {/if} ">
    <div class="row">
        <div class="col-md-2 left-section">
            <!-- 左导航菜单 -->
            {include file="common/page/menu"}

        </div>
        <div class="col-md-10 right-section">
            <!--内容区域-->
            <h3><i class="icon iconfont">{$Think.session.currentMenu.icon}</i>编辑商品</h3>
            <div class="inner-section row">
                <form role="form"  method="post" id="myForm"  enctype="multipart/form-data">
                    <table class="table table-striped table-hover table-bordered table-base">
                        <tr>
                            <td class="td1"><label>分类</label></td>
                            <td class="td2">
                            	<div class="category-list row">
                            		{foreach name="cateList" item="cate"}
                            			<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 category">{$cate.name}</div>
                            		{/foreach}
                            	</div>
                            </td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label>多规格模板</label></td>
                            <td class="td2">
                            	<select class="form-inline" name="tid" id="tid" disabled>
                            		<option value="" {if $goods.standard eq '0'} selected {/if} >统一规格</option>
                            		{foreach name="templateList" item="template"}
                            		<option value="{$template.id}" {if $goods.standard eq '1' && $goods.tid eq $template.id} selected {/if} >{$template.name}</option>
                            		{/foreach}
                            	</select>
                            	<a class="reset-property" href="javascript:;">重新选择</a>
                            	<input type="hidden" name="is_reset" id="is_reset" value="0">
                            	<input type="hidden" name="standard" id="standard" value="{$goods.standard}">
                            	<input type="hidden" name="propertyGroups" id="propertyGroups" value="">
                            </td>
                            <td class="td3"></td>
                        </tr>
                        <tr class="property-tr {if !$propertyGroups} hidden {/if} ">
                            <td class="td1"><label>商品属性</label></td>
                            <td class="td2">
                             	<div class="property-group-wrap">
                                    {foreach name = "propertyGroups" item = "group"} 
                                    <div class="property-group">
                                        {foreach name = "group.propertyList" item = "property"}
                                        <span class="span property">
                                           <span  class="property-name">{$property->name}</span>
                                           <span class="property-value">【{$property->value}】</span>
                                        </span>
                                        {/foreach}
                                        <span class="span" data-gpid="{$group.id}>">
                                           <span>单买价</span>
                                           <input type="text" class="oriprice" value="{$group.ori_price}">
                                        </span>
                                        <span class="span" data-gpid="{$group.id}">
                                           <span>拼团价</span>
                                           <input type="text" class="price" data-price="{$group.price}" value="{$group.price}">
                                        </span>
                                        <span class="span" data-gpid="{$group.id}">
                                           <span>库存</span>
                                           <input type="text" class="inventory" value="{$group.inventory}">
                                        </span>
                                        <a class="btn btn-danger btn-xs delete" href="javascript:;" data-gpid="{$group.id}">删除</a>
                                    </div>
                                    {/foreach}
                                </div>
                                <div class="add-property-group-wrap">
                                    <span class="property-group-action">
                                 	  <a class="btn btn-primary btn-sm property-group-add" href="javascript:;">添加</a>
                                 	  <span class="property-group-add-tips">(添加新规格请保证与原规格属性内容数目一致)</span>
                                    </span>
                                </div>
                            </td>
                            <td class="td3 property-info"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label><span class="must-tag">*</span>商品名称</label></td>
                            <td class="td2"><input type="text" value="{$goods.name}" id="name" name="name" placeholder="商品名称"></td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label for="imgurl"><span class="must-tag">&nbsp;&nbsp;</span>主图更新</label></td>
                            <td class="td2">
                                <input class="imgurl form-control"  accept="image/*" value="" title="支持jpg、jpeg、gif、png格式，文件小于5M" tabindex="3" type="file" id="imgurl"name="imgurl" size="3">
                                <img src="{$Think.const.ROOT_URL}{$goods.img_url}" style="height: 34px;width:50px;"  title="缩略图" >
                            </td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label><span class="must-tag">&nbsp;&nbsp;</span>辅图更新</label></td>
                            <td class="td2">
                                {for start="0" end="3" name="i" step="1"}
                                <div class="side-image-wrap">
                                    <input type="file" name="sideImg[]" class="side-image form-control" value="">
                                    {if condition="isset($imgList[$i])"}
                                    <img src="{$Think.const.ROOT_URL}{$imgList[$i]}" class="thumb" style="height: 34px;width:50px;" title="缩略图">
                                    <a class="delete-slide-image btn btn-danger btn-xs" data-img="{$imgList[$i]}" data-gid="{$goods.id}">删除</a>
                                    {/if}
                                </div>
                                {/for}
                                <input type="hidden" name="deleteImg" id="deleteImg">
                            </td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label for="team_num"><span class="must-tag">*</span>拼团活动时间</label></td>
                            <td class="td2">
                                <input id="start_time" name="start_time" type="text" class="input-normal search Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:186px" value="{$goods.start_time}"/>
                                -
                                <input id="end_time" name="end_time" type="text" class="input-normal search Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:186px" value="{$goods.end_time}"/>
                            </td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label for="team_num"><span class="must-tag">*</span>拼团人数</label></td>
                            <td class="td2"><input type="text" id="team_num" name="team_num" value="10" placeholder="拼团人数" value="{$goods.team_num}"></td>
                            <td class="td3"></td>
                        </tr>
                        <tr class="{if $goods.standard neq 0} hidden {/if} ">
                            <td class="td1"><label for="name"><span class="must-tag">*</span>拼团价格</label></td>
                            <td class="td2"><input type="text" id="price" name="price" placeholder="拼团价格" value="{$goods.price}"></td>
                            <td class="td3"></td>
                        </tr>
                        <tr class="{if $goods.standard neq 0} hidden {/if} ">
                            <td class="td1"><label for="ori_price"><span class="must-tag">*</span>商品原价</label></td>
                            <td class="td2">
                                <input type="text" id="ori_price" name="ori_price" value="{$goods.ori_price}" placeholder="商品原价"></td>
                            <td class="td3"></td>
                        </tr>
                        <!--当前商品为统一规格-->
                        <tr  class="{if $goods.standard neq 0} hidden {/if} ">
                            <td class="td1"><label for="inventory"><span class="must-tag">*</span>商品库存</label></td>
                            <td class="td2"><input type="text" id="inventory" name="inventory" value="{$goods.inventory}" placeholder="商品库存"></td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label for="simpledesc"><span class="must-tag">*</span>商品简述</label></td>
                            <td class="td2">
                                <!-- umeditor -->
                                <script type="text/plain" id="simpledesc" name="simple_desc" style="width:780px;height:200px;">{$goods.simple_desc}</script>
                                <script type="text/javascript">
                                    //实例化编辑器
                                    var um = UM.getEditor('simpledesc');
                                </script>
                                <!-- /umeditor -->
                            </td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label for="sortnum"><span class="must-tag">*</span>排序系数</label></td>
                            <td class="td2"><input type="text" id="sortnum" name="sort_num" value="{$goods.sort_num}" placeholder="排序系数"></td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label><span class="must-tag">*</span>商品状态</label></td>
                            <td class="td2">
                                <label><input type="radio" name="updown" value="1" {if $goods.updown eq '1'} checked {/if} > 上架</label>
                                <label><input type="radio" name="updown" value="0"  {if $goods.updown eq '0'} checked {/if} >下架</label>
                            </td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td class="td1"><label><span class="must-tag">*</span>首页推荐</label></td>
                            <td class="td2">
                                <label> <input type="radio" name="recommend" value="0" {if $goods.recommend eq '0'} checked {/if} > 不推荐</label>
                                <label> <input type="radio" name="recommend" value="1"   {if $goods.recommend eq '1'} checked {/if} >推荐</label>
                            </td>
                            <td class="td3"></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <input type="hidden" id='id' name="id" value="{$goods.id}">
                                <input type="hidden" id='addGroups' name="add_groups" value="">
                                <input type="hidden" id='addProperty' name="add_property" value="0">
                                <!--0为统一规格,1为多规格-->
                                <button type="button" class="btn btn-success btn-md" id='save'>提交</button>
                                <button type="button" class="btn btn-default btn-md" id="back">返回</button>
                            </td>
                            <td></td>
                        </tr>
                    </table>

                </form>
            </div>
        </div>
    </div>
</div>

<!-- 页脚 -->
{include file="common/page/footer"}

<script type="text/javascript" src="__static__/js/form/jquery.form.js"></script>
<script type="text/javascript" src="__static__/js/form/jquery.validate.js"></script>
<script type="text/javascript" src="__static__/js/form/jquery.validate.extend.js"></script>
<script type="text/javascript" src="__app__/admin/view/AssembleGoods/editGoods/editGoods.js"></script>
</body>
</html>

